/**
 * 打印配置数据
 * 不同流程需要在这里配置数据，用来渲染模版
 * subTitle  小标题
 * type 类型 form:表单样式  table:表格模式  process:流程审批记录模式
 *
 * children 下的属性
 * condition 条件，如果存在需要判断里面的条件符合才展示
 * label：名称
 * keyword：数据字段
 * type: 一些需要处理的字段类型，比如：time时间、options选项、money金钱
 */
import { PROCESS_TYPE } from '@/utils/const/process'; // 审批流程类型
const ans = {};
// 员工报销
const REIMBURSEMENT = {
  title: '员工报销审批单',
  config: [
    {
      subTitle: '基础信息',
      type: 'form',
      children: [
        { list: [{ label: '审批单号', keyword: 'approvalNo' }, { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }] },
        { list: [{ label: '创建人', keyword: 'creator' }, { label: '所属部门', keyword: 'attributionMatrixName' }] },
        { list: [{ label: '申请人', keyword: 'proposer' }, { label: '申请部门', keyword: 'departmentName' }] },
        { list: [{ label: '所属公司', keyword: 'companyName' }, { label: '报销类型', keyword: 'type', type: 'options', options: { 0: '常规', 1: '差旅' }}] },
        { list: [{ label: '分摊费用', keyword: 'isAllocation', type: 'options', options: { 0: '否', 1: '是' }}, { label: '冲抵借款', keyword: 'isWriteOff', type: 'options', options: { 0: '否', 1: '是' }}] },
        {
          condition: { isWriteOff: 1 }, // 冲抵借款为是才展示
          list: [{ label: '借款欠额', keyword: 'arrearsAmount', subLabel: '实时', subKeyword: 'realTimeArrearsAmount', type: 'money' }, { label: '冲抵借款欠额', keyword: 'writeOffAmount', type: 'money' }]
        },
        { list: [{ label: '实付金额', keyword: 'paymentAmount', type: 'money' }, { label: '附件', keyword: 'attachment', type: 'array', arrKey: 'name' }] }
      ]
    },
    {
      subTitle: '收款账户',
      type: 'table',
      keyword: 'accountInfo',
      children: [
        { title: '收款户名', keyword: 'payName' },
        { title: '收款账号', keyword: 'payNum' },
        { title: '银行', keyword: 'bank' },
        { title: '省市', keyword: 'province' },
        { title: '支行', keyword: 'subBank' }
      ]
    },
    {
      subTitle: '报销项目',
      type: 'table',
      keyword: 'commonProjectList',
      condition: { type: 0 }, // 报销类型为常规才展示
      children: [
        { title: '报销项目', keyword: 'projectName' },
        { title: '报销金额(元)', keyword: 'amount', type: 'money' },
        { title: '报销说明', keyword: 'desc' }
        // { title: '标签', keyword: 'tag', type: 'array', aryKey: 'name' }
      ],
      foot: { title: '总报销金额(元)', keyword: 'totalReimbursementAmount', type: 'money' }
    },
    {
      subTitle: '报销项目',
      type: 'table',
      keyword: 'travelProjectList',
      condition: { type: 1 }, // 报销类型为差旅才展示
      children: [
        { title: '目的地', keyword: 'arrival' },
        { title: '住宿费(元)', keyword: 'hotelFee', type: 'money' },
        { title: '交通费(元)', keyword: 'carFare', type: 'money' },
        { title: '商务宴请费(元)', keyword: 'banquetFee', type: 'money' },
        { title: '出差补助(元)', keyword: 'travelAllowance', type: 'money' }
      ],
      foot: { title: '总报销金额(元)', keyword: 'totalReimbursementAmount', type: 'money' }
    },
    {
      subTitle: '分摊费用',
      type: 'table',
      keyword: 'allocationList',
      condition: {},
      children: [
        { title: '分摊部门', keyword: 'deptName' },
        { title: '分摊金额(元)', keyword: 'amount', type: 'money' },
        { title: '分摊说明', keyword: 'desc' }
      ],
      foot: { title: '总分摊金额(元)', mathKeyword: 'amount' }
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};
// 开票申请
const ISSUE_INVOICE = {
  title: '开票申请审批单',
  config: [
    {
      subTitle: '申请信息',
      type: 'form',
      labelSpan: 5,
      children: [
        { list: [{ label: '审批单号', keyword: 'approvalNo' }, { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }] },
        { list: [{ label: '创建人', keyword: 'creator' }, { label: '所属部门', keyword: 'department' }] },
        { list: [{ label: '申请人', keyword: 'proposer' }, { label: '申请部门', keyword: 'applyDepartment' }] },
        { list: [{ label: '我方抬头', keyword: 'ourTitle' }, { label: '发票类型', keyword: 'invoiceType' }] },
        { list: [{ label: '发票接收邮箱', keyword: 'email' }, { label: '开票项目', keyword: 'project' }] },
        { list: [{ label: '含税金额', keyword: 'amount' }, { label: '发票票面备注', keyword: 'remark' }] },
        { list: [{ label: '附件', keyword: 'attachment', type: 'array', arrKey: 'name' }, { label: '是否到账', keyword: 'isArrival', type: 'options', options: { 0: '否', 1: '是' }}] },
        { list: [{ label: '合同签订', keyword: 'isSign', type: 'options', options: { 0: '未签订', 1: '已签订' }}] }
      ]
    },
    {
      subTitle: '纳税人信息',
      type: 'form',
      labelSpan: 5,
      children: [
        { list: [{ label: '纳税人名称', keyword: 'taxpayer' }, { label: '纳税人识别号', keyword: 'taxpayerNum' }] },
        { list: [{ label: '开户行', keyword: 'accountsBank' }, { label: '开票地址', keyword: 'issueAddress' }] },
        { list: [{ label: '开户账号', keyword: 'accountNum' }, { label: '注册电话', keyword: 'phone' }] },
        { list: [{ label: '一般纳税人证明', keyword: 'certificateFile', type: 'array', arrKey: 'name' }] }
      ]
    },
    {
      subTitle: '关联到账流水',
      type: 'table',
      keyword: 'financeTxnList',
      condition: { isArrival: 1 },
      children: [
        { title: '到账日期', keyword: 'arrivalTime', type: 'time', format: 'YYYY/MM/DD' },
        { title: '交易单号', keyword: 'transactionNumber' },
        { title: '收入金额(元)', keyword: 'incomeAmount', type: 'money', unit: '分' },
        { title: '付款人名称', keyword: 'payName' },
        { title: '付款账号', keyword: 'payNumber' }
      ],
      foot: { title: '总收入金额(元)', mathKeyword: 'incomeAmount', unit: '分' }
    },
    {
      subTitle: '合同信息',
      type: 'table',
      keyword: 'contractInfo',
      condition: { isSign: 1 },
      children: [
        { title: '项目名称', keyword: 'contractName' },
        { title: '合同编号', keyword: 'contractCode' },
        { title: '审批进度', keyword: 'reviewProgress' },
        { title: '申请人部门', keyword: 'department' }
      ]
    },
    {
      subTitle: '发票信息',
      type: 'table',
      keyword: 'invoiceInfo',
      children: [
        { title: '发票号码', keyword: 'number' },
        { title: '含税金额', keyword: 'amount', type: 'money' },
        { title: '发票附件', keyword: 'attachment', type: 'array', arrKey: 'name' },
        { title: '开票人', keyword: 'userName' },
        { title: '开票日期', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }
      ],
      foot: { title: '含税金额(元)', mathKeyword: 'amount' }
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};
// 借款申请
const LOAN = {
  title: '借款申请审批单',
  config: [
    {
      subTitle: '基础信息',
      type: 'form',
      children: [
        { list: [{ label: '审批单号', keyword: 'approvalNum' }, { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }] },
        { list: [{ label: '创建人', keyword: 'creator' }, { label: '所属部门', keyword: 'subordinateDepartment' }] },
        { list: [{ label: '申请人', keyword: 'applicant' }, { label: '申请部门', keyword: 'applyDepartment' }] },
        { list: [{ label: '所属公司', keyword: 'company' }, { label: '借款周期', startTime: 'loanStartDate', endTime: 'loanEndDate', type: 'timeRange' }] },
        { list: [{ label: '借款说明', keyword: 'remark' }, { label: '借款金额', keyword: 'amount', type: 'money', unit: '分' }] },
        { list: [{ label: '附件', keyword: 'attachment', type: 'array', arrKey: 'name' }] }
      ]
    },
    {
      subTitle: '收款账户',
      type: 'table',
      keyword: 'accountInfo',
      children: [
        { title: '收款户名', keyword: 'payName' },
        { title: '收款账号', keyword: 'payNum' },
        { title: '银行', keyword: 'bank' },
        { title: '省市', keyword: 'province' },
        { title: '支行', keyword: 'subBank' }
      ]
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};

// 还款申请
const PAYBACK = {
  title: '还款申请审批单',
  config: [
    {
      subTitle: '基础信息',
      type: 'form',
      children: [
        { list: [{ label: '审批单号', keyword: 'sn' }, { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }] },
        { list: [{ label: '创建人', keyword: 'createUser' }, { label: '所属部门', keyword: 'department' }] },
        { list: [{ label: '申请人', keyword: 'proposer' }, { label: '申请部门', keyword: 'proposerDepartment' }] },
        { list: [{ label: '所属公司', keyword: 'ourTitle' }, { label: '还款说明', keyword: 'description' }] },
        { list: [{ label: '借款金额', keyword: 'dueAmount', subLabel: '实时', subKeyword: 'reallyAmount', type: 'money', unit: '分' }, { label: '还款金额', keyword: 'backAmount', type: 'money', unit: '分' }] },
        { list: [{ label: '附件', keyword: 'attachment', type: 'array', arrKey: 'name' }] }
      ]
    },
    {
      subTitle: '关联借款单',
      type: 'table',
      keyword: 'linkList',
      children: [
        { title: '审批单号', keyword: 'approvalNum' },
        { title: '借款金额(元)', keyword: 'amount', type: 'money', unit: '分' },
        { title: '借款说明', keyword: 'remark' },
        { title: '借款周期', startTime: 'loanStartDate', endTime: 'loanEndDate', type: 'timeRange' },
        { title: '申请人', keyword: 'applicant' },
        { title: '申请部门', keyword: 'applyDepartment' },
        { title: '所属公司', keyword: 'company' }
      ],
      foot: { title: '总借款金额(元)', mathKeyword: 'amount', unit: '分' }
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};

// 转交欠款
const ARREARS_TRANSFER = {
  title: '转交欠款审批单',
  config: [
    {
      subTitle: '基础信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '审批单号', keyword: 'approvalNo' },
            { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' }
          ]
        },
        {
          list: [
            { label: '创建人', keyword: 'creator' },
            { label: '所属部门', keyword: 'department' }
          ]
        }
      ]
    },
    {
      subTitle: '转交信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '转交人', keyword: 'passer' },
            { label: '被转交人', keyword: 'transferee' }
          ]
        },
        {
          list: [
            { label: '转交欠款', keyword: 'amount', type: 'money', unit: '分' },
            { label: '转交说明', keyword: 'remark' }
          ]
        }
      ]
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};
// 客户调额申请
const CUSTOMER_ADJUSTMENT = {
  title: '客户调额申请',
  config: [
    {
      subTitle: '申请信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '审批单号', keyword: 'approvalNo' },
            { label: '创建人', keyword: 'creator' }
          ]
        },
        {
          list: [
            { label: '创建时间', keyword: 'createTime', type: 'time', format: 'YYYY/MM/DD HH:mm' },
            { label: '申请部门', keyword: 'proposerDepartment' }
          ]
        },
        {
          list: [
            { label: '申请人', keyword: 'proposer' },
            { label: '申请范围', keyword: 'range' }
          ]
        },
        {
          list: [
            { label: '申请说明', keyword: 'description' },
            { label: '附件', keyword: 'attachment' }
          ]
        }
      ]
    },
    {
      subTitle: '当前客户信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '客户名称', keyword: 'customerName' },
            { label: '客户类型', keyword: 'customerType', type: 'options', options: { 0: '公司', 1: '个人' }}
          ]
        },
        {
          list: [
            { label: '客户状态', keyword: 'customerStatusStr' },
            { label: '客户等级', keyword: 'customerLevelInfo' }
          ]
        },
        {
          list: [
            { label: '欠款额度', keyword: 'customerQuota' },
            { label: '欠款账期', keyword: 'accountPeriod' }
          ]
        },
        {
          list: [
            { label: '客户行业', keyword: 'customerBusiness' },
            { label: '标签', keyword: 'customerTag' }
          ]
        },
        {
          list: [
            { label: '客户来源', keyword: 'customerSource' },
            { label: '所属集团', keyword: 'customerGroup' }
          ]
        },
        {
          list: [
            { label: '所属部门', keyword: 'customerDepartment' },
            { label: '销售', keyword: 'sale' }
          ]
        },
        {
          list: [
            { label: '备注', keyword: 'remark' }
          ]
        }
      ]
    },
    {
      subTitle: '申请调整内容',
      type: 'form',
      children: [
        {
          list: [
            { label: '申请客户等级', keyword: 'customerLevel' },
            { label: '欠款额度', keyword: 'loanQuota' }
          ]
        },
        {
          list: [
            { label: '欠款账期', keyword: 'loanPeriod' },
            { label: '申请提升额度', keyword: 'quotaApplication' }
          ]
        },
        {
          list: [
            { label: '申请提升账期', keyword: 'payPeriodApplication' }
          ]
        }
      ]
    },
    {
      subTitle: '调整后客户信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '客户等级', keyword: 'adjustCustomerLevel' },
            { label: '欠款额度', keyword: 'adjustLoanQuota' }
          ]
        },
        {
          list: [
            { label: '欠款账期', keyword: 'adjustLoanPeriod' }
          ]
        }
      ]
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};
// 外采额度申请
const EXTERNALHARVEST = {
  title: '外采额度申请',
  config: [
    {
      subTitle: '申请信息',
      type: 'form',
      children: [
        {
          list: [
            { label: '审批单号', keyword: 'sn' },
            { label: '创建人', keyword: 'creator' }
          ]
        },
        {
          list: [
            { label: '创建时间', keyword: 'createDate', type: 'time', format: 'YYYY/MM/DD HH:mm' },
            { label: '申请部门', keyword: 'proposerDepartment' }
          ]
        },
        {
          list: [
            { label: '申请人', keyword: 'proposerName' },
            { label: '总外采额度', keyword: 'allAmount', type: 'money' }
          ]
        },
        {
          list: [
            { label: '剩余外采额度', keyword: 'remainingAmount', type: 'money' },
            { label: '申请外采额度', keyword: 'applicationAmount', type: 'money' }
          ]
        },
        {
          list: [
            { label: '申请说明', keyword: 'description' },
            { label: '授权人', keyword: 'authUser' }
          ]
        },
        {
          list: [
            { label: '授权人可授权额度', keyword: 'authAmount', type: 'money' },
            { label: '附件', keyword: 'attachment', type: 'array', arrKey: 'name' }
          ]
        }
      ]
    },
    { subTitle: '审批流程', type: 'process' }
  ]
};
ans[PROCESS_TYPE.REIMBURSEMENT] = REIMBURSEMENT; // 员工报销
ans[PROCESS_TYPE.ISSUE_INVOICE] = ISSUE_INVOICE; // 开票申请
ans[PROCESS_TYPE.LOAN] = LOAN; // 借款申请
ans[PROCESS_TYPE.PAYBACK] = PAYBACK; // 还款申请
ans[PROCESS_TYPE.ARREARS_TRANSFER] = ARREARS_TRANSFER; // 转交欠款
ans[PROCESS_TYPE.CUSTOMER_ADJUSTMENT] = CUSTOMER_ADJUSTMENT; // 客户调额申请
ans[PROCESS_TYPE.EXTERNALHARVEST] = EXTERNALHARVEST; // 外采额度申请
export default ans;
